<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
	th:replace="fragments/generic-frame::frame(~{fragments/menu::menu(3)}, ~{::th}, ~{::tr}, ~{::form}, ~{::script})">
<head></head>
<body>

	<th>机房名称</th>
	<th>实验课程</th>
	<th>课程老师</th>
	<th>第几周开始</th>
	<th>第几周结束</th>
	<th>星期几上课</th>
	<th>第几节课</th>
	<th>课程状态</th>
	<th>操作</th>

	<tr th:each="experiment: ${list}">
		<th:block th:with="ex=${experiment.course}">
			<td><input type="checkbox" id="check-all" class="flat"></td>
			<td th:text="${ex.classroom}">D402</td>
			<td th:text="${ex.name}">Web高级编程</td>
			<td th:text="${experiment.teacher}">张恒锋</td>
			<td th:text="${ex.startweek}">10</td>
			<td th:text="${ex.endweek}">17</td>
			<td th:text="${ex.dayofweek}">1</td>
			<td th:text="${ex.lesson}">2</td>
			<td th:if="${ex.state==0}">还未通过审核</td>
			<td th:if="${ex.state==1}">审核通过</td>
			<td th:if="${ex.state==2}">审核不通过</td>
			<td th:if="${ex.state==3}">已结课</td>
			<td><a th:attr="data-id=${ex.no}" href="#"
				class="btn-sm btn-info" data-toggle="modal"
				data-target="#edit-modal">调整机房地点</a></td>
		</th:block>
	</tr>
	<form id="modal-form" action="arrange-location" method="post">
		<input id="course" name="course" type="hidden" />
		<div class="form-group">
			<label for="classroom" class="control-label">机房名称:</label> <input
				type="text" name="classroom" class="form-control" id=classroom>
		</div>
	</form>
	<script type="text/javascript">
		$(function() {
			$('#edit-modal').on('show.bs.modal', function(e) {
				var modal = $(e.currentTarget);
				var btn = $(e.relatedTarget);
				var tds = btn.closest('tr').find('td');
				modal.find('#classroom').val(tds.eq(1).text());
				modal.find('#course').val(btn.data('id'))
			});
		})
	</script>
</body>
</html>